@using BlazorApp.Utils
@using k8s.Models
@inherits BlazorApp.Pages.Common.PageBase

<Divider Orientation="left" Style="font-weight:bold">@L["Endpoints"]</Divider>
@if (Items is { Count: > 0 })
{
    <Table TItem="V1Endpoints" DataSource="@Items"
           HidePagination="true" PageSize="5000"
           Size=@TableSize.Small Bordered="true">
        <AntDesign.Column Title=@L["Name"] TData="string">
            <Button OnClick="@(() => OnItemNameClick(context))" Type="@ButtonType.Link">@context.Name()</Button>
        </AntDesign.Column>
        <AntDesign.Column Sortable="true" TData="string" Title=@L["Namespace"] Field="@context.Namespace()"/>
    </Table>
}
@if (Items == null || Items.Count == 0)
{
    <Empty Simple/>
}

@code
{


    [Parameter] public IList<V1Endpoints> Items { get; set; } = new List<V1Endpoints>();

    private async Task OnItemNameClick(V1Endpoints item)
    {
        await PageDrawerHelper<V1Endpoints>.Instance
            .SetDrawerService(PageDrawerService.DrawerService)
            .ShowDrawerAsync<EndpointsDetailView, V1Endpoints, bool>(item);
    }

}
